package com.link2room.ironhide.controller.manager;

import com.link2room.common.dto.result.base.BaseResultDto;
import com.link2room.common.dto.threadlocal.BaseThreadLocal;
import com.link2room.common.jpa.result.QueryResult;
import com.link2room.ironhide.entity.L2RMemberLevel;
import com.link2room.sideswipe.permissionResouces.annotation.L2RPermissionResources;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

import static com.link2room.ironhide.constant.PermissionConstant.memberLevels;

/**
 * Created by VegetaKo on 2017/1/12.
 */
@Api(tags= "会员基础管理")
@RestController
@RequestMapping("/manager/Member")
public class MemberLevelManagerController {

    @ApiOperation(value="获取会员等级",response = L2RMemberLevel.class)
    @RequestMapping(value = "/MemberLevels",method = RequestMethod.GET)
    @L2RPermissionResources(value = memberLevels,name = "获取会员等级")
    public BaseResultDto memberLevels() throws Exception {
        List<L2RMemberLevel > l2RMemberLevelList = new ArrayList<L2RMemberLevel>();
        L2RMemberLevel l2RMemberLevel1 = new L2RMemberLevel();
        l2RMemberLevel1.setId(1L);
        l2RMemberLevel1.setLhotelGroupCode("L2R");
        l2RMemberLevel1.setLhotelCode("L2R");
        l2RMemberLevel1.setMemberLevel("L0");
        l2RMemberLevel1.setMemberLevelDescript("E会员");
        l2RMemberLevel1.setIsHalt("F");
        l2RMemberLevelList.add( l2RMemberLevel1);

        L2RMemberLevel l2RMemberLevel2 = new L2RMemberLevel();
        l2RMemberLevel2.setId(2L);
        l2RMemberLevel2.setLhotelGroupCode("L2R");
        l2RMemberLevel2.setLhotelCode("L2R");
        l2RMemberLevel2.setMemberLevel("L1");
        l2RMemberLevel2.setMemberLevelDescript("银牌会员");
        l2RMemberLevel2.setIsHalt("F");
        l2RMemberLevelList.add( l2RMemberLevel2);

        L2RMemberLevel l2RMemberLevel3 = new L2RMemberLevel();
        l2RMemberLevel3.setId(3L);
        l2RMemberLevel3.setLhotelGroupCode("L2R");
        l2RMemberLevel3.setLhotelCode("L2R");
        l2RMemberLevel3.setMemberLevel("L2");
        l2RMemberLevel3.setMemberLevelDescript("金牌会员");
        l2RMemberLevel3.setIsHalt("F");
        l2RMemberLevelList.add( l2RMemberLevel3);

        L2RMemberLevel l2RMemberLevel4 = new L2RMemberLevel();
        l2RMemberLevel4.setId(4L);
        l2RMemberLevel4.setLhotelGroupCode("L2R");
        l2RMemberLevel4.setLhotelCode("L2R");
        l2RMemberLevel4.setMemberLevel("L3");
        l2RMemberLevel4.setMemberLevelDescript("铂金会员");
        l2RMemberLevel4.setIsHalt("F");
        l2RMemberLevelList.add( l2RMemberLevel4);

        QueryResult<L2RMemberLevel> l2RMemberLevelQueryResult = new QueryResult<>();
        l2RMemberLevelQueryResult.setCurrentPage(1);
        l2RMemberLevelQueryResult.setTotalrecord(4);
        l2RMemberLevelQueryResult.setResultlist( l2RMemberLevelList);
        BaseResultDto l2rRs=new BaseResultDto();
        l2rRs.setOptId(BaseThreadLocal.getOptId());
        l2rRs.setResultCode(0);
        l2rRs.setQueryResult(l2RMemberLevelQueryResult);
        return l2rRs;
    }
}
